﻿<UserControl x:Class="Flickr.Sample.Controls.PhotoCollectionView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
             xmlns:agfxctls="clr-namespace:AgFx.Controls;assembly=AgFx.Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <ScrollViewer x:Name="sv" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
        <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" DataContext="{Binding}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Text="Updating..." Visibility="{Binding IsUpdating, Converter={StaticResource visibilityConverter}}"/>
            <TextBlock DataContext="{Binding}" Text="{Binding Path=LastUpdated, ConverterParameter=Last Updated: \{0\}, Converter={StaticResource stringFormatConverter}}" ManipulationCompleted="UpdatedTextBlock_ManipulationCompleted" Visibility="{Binding IsUpdating, Converter={StaticResource visibilityConverter}, ConverterParameter=!}" />
            
            
            
            <ItemsControl ItemsSource="{Binding Photos}" Grid.Row="1">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid Height="75" Width="350" Margin="0,0,0,2">
                            <Rectangle Fill="Silver" Width="75" Height="75" HorizontalAlignment="Left" VerticalAlignment="Top" />
                            <Image Width="75" Height="75" Source="{Binding PhotoUrls.ThumbnailUrl}" HorizontalAlignment="Left" VerticalAlignment="Center"/>

                            <agfxctls:HyperlinkButtonEx HorizontalContentAlignment="Left" Content="{Binding Title}" NavigateUrlFormat="/PhotoView.xaml?{0}" Click="Photo_Click" NavigateUrlParam="{Binding PhotoId}" Margin="77, 0, 0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>                           
                            
                            
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
            
            <HyperlinkButton Content="Previous Page" Grid.Row="2" HorizontalAlignment="Left" Click="PrevPage_Click" IsEnabled="{Binding CanPageBackward}" />
            <HyperlinkButton Content="Next Page" Grid.Row="2" HorizontalAlignment="Right" Click="NextPage_Click" IsEnabled="{Binding CanPageForward}"/>

        </Grid>
    </ScrollViewer>
</UserControl>
